package com.ict.web.controller.yzq;

import java.util.List;

import com.ict.web.domain.TechnicalTitle;
import com.ict.web.dto.InsertTechnicalTitleDto;
import com.ict.web.dto.UpdateTechnicalTitleDto;
import com.ict.web.service.ITechnicalTitleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ict.common.annotation.Log;
import com.ict.common.core.controller.BaseController;
import com.ict.common.core.domain.AjaxResult;
import com.ict.common.enums.BusinessType;
import com.ict.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.Valid;

/**
 * 技术职称Controller
 * 
 * @author liujie
 * @date 2022-02-23
 */
@Api(tags = "技术职称")
@RestController
@RequestMapping("/system/title")
public class TechnicalTitleController extends BaseController
{
    @Autowired
    private ITechnicalTitleService technicalTitleService;


    /**
     * 新增技术职称
     */
    @ApiOperation("新增技术职称")
    @Log(title = "技术职称", businessType = BusinessType.INSERT)
    @PostMapping("/addSave")
    public AjaxResult add(Long expertId,@RequestBody List<InsertTechnicalTitleDto> dtoS)
    {
        technicalTitleService.insertTechnicalTitle(expertId,dtoS);
        return AjaxResult.success();
    }

    /**
     * 修改技术职称
     */
    @ApiOperation("修改技术职称")
    @Log(title = "技术职称", businessType = BusinessType.UPDATE)
    @PutMapping("/editSave")
    public AjaxResult edit(@RequestBody UpdateTechnicalTitleDto dto)
    {
        return toAjax(technicalTitleService.updateTechnicalTitle(dto));
    }

    /**
     * 删除技术职称
     */
    @ApiOperation("删除技术职称")
    @Log(title = "技术职称", businessType = BusinessType.DELETE)
	@DeleteMapping("/{technicalId}")
    public AjaxResult remove(@PathVariable Long technicalId)
    {
        return toAjax(technicalTitleService.deleteTechnicalTitleByTechnicalId(technicalId));
    }
}
